package com.aries.ui.widget.demo.module.tab;

import com.aries.ui.widget.demo.ResourceTable;
import ohos.aafwk.ability.fraction.Fraction;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.LayoutScatter;
import ohos.agp.components.Text;

public class SimpleFraction extends Fraction {
    private String mTitle;

    public static SimpleFraction getInstance(String title) {
        SimpleFraction sf = new SimpleFraction();
        sf.mTitle = title;
        return sf;
    }
    @Override
    protected Component onComponentAttached(LayoutScatter scatter, ComponentContainer container, Intent intent) {
        Component component=scatter.parse(ResourceTable.Layout_fr_simple_card,container,false);
        Text text = (Text) component.findComponentById(ResourceTable.Id_card_title_tv);
        text.setText("Switch Fragment "+mTitle);
        return component;
    }

}
